window.lpTag=window.lpTag||{};lpTag.taglets=lpTag.taglets||{};lpTag.taglets.SurveyLogic=lpTag.taglets.SurveyLogic||function(a){if(!a.survey||"object"!=typeof a.survey||this===window)return!1;this.survey=a.survey.survey||a.survey;this.createQuestionsMap();this.defaultSelectValue=a.defaultSelectValue||"";this.header=this.survey.header||""};!function(a){var b="prototype";a[b].questionTypes={TEXTF:"Text Field",TEXT:"Text Area",SELECT:"Dropdown Box",RADIO:"Radio Button",RADIOH:"Radio Button (side by side)",CHECKBOX:"Checkbox",CSAT:"CSAT"};a[b].validationTypes={EMAIL:"email",NUMBER:"numeric",STRING:"alpha_numeric",CSAT:"csat",PHONE:"phoneNumber"};a[b].errorTypes={EMAIL:"email",NUMBER:"numeric",ILLEGAL_CHARS:"illegal_chars",REQUIRED:"required",CSAT_RANGE:"csat_range",LENGTH:"length",PHONE:"phoneNumber"};a[b].questionsText={MAX_LENGTH:2e3};a[b].csatRange={lowest:0,highest:5};a[b].getAllQuestions=function(){return this.survey&&this.survey.questions&&this.survey.questions.question&&this.survey.questions.question.constructor===Array?this.survey.questions.question:[]};a[b].createQuestionsMap=function(){this.questionLogicMap={};this.questionIdMap={};this.mandatoryQuestions=[];for(var a=this.getAllQuestions(),b=0;b-1&&c.length>d?c[d]:{}};a[b].submitAnswerGetNextQuestions=function(a,b){this.submitAnswer(a,b);return this.getActiveQuestions({getExcluded:!0})};a[b].getActiveQuestions=function(a){for(var b=this.getAllQuestions(),c={},d=[],e=[],f=!1,g=!(!a||!a.getExcluded)&&a.getExcluded,h=!(!a||!a.mandatoryOnly)&&a.mandatoryOnly,i=0;i0)&&a.survey.question.push(d)}}catch(e){}return a};a[b].createQuestionJSON=function(a){var b={id:a.id,answer:[]};if(a.entry)for(var c=0;c',b=this.getActiveQuestions(),c=0;c";return a};a[b].createQuestionXML=function(a){var b=!1,c='';if(a.entry){for(var d=0;d"+a.entry[d].value+"";b=!0}}else if(a.lastKnownValue){c+=""+a.lastKnownValue+"";b=!0}c+="";return{XML:c,hasAnswer:b}};a[b].validateSurvey=function(a){var b={surveyValid:!0,questionsNeeded:[]},c=!a||"boolean"!=typeof a||!a,d=this.getActiveQuestions({mandatoryOnly:c});try{for(var e=0;e=this.csatRange.lowest&&a<=this.csatRange.highest};a[b].isValidChars=function(a){return a.search(/<|>|\"/)<0};a[b].isValidEmail=function(a){try{return new RegExp(/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/).test(a)}catch(b){return!1}};a[b].isValidPhoneNumber=function(a){try{return new RegExp(/^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\.\/0-9]*$/g).test(a)}catch(b){return!1}};a[b].isNumber=function(a){return!isNaN(a)};a[b].isString=function(a){return"string"==typeof a};a[b].isValidLength=function(a){return a.length<=this.questionsText.MAX_LENGTH};a[b].dispose=function(){for(var a in this)if(this.hasOwnProperty(a)){this[a]=null;delete this[a]}}}(lpTag.taglets.SurveyLogic);